TeX Memo
references
-
Latexコマンドシート一覧
-
amsmathの数式環境まとめ
-
Latex_TW section中の数式など
Shade
\usepackage{shaded}
\definecolor{shadecolor}{gray}{0.90}
\begin{shaded}
ほげほげ
\end{shaded}
とすると、「ほげほげ」のところが灰色で塗りつぶされた四角で囲まれる。今まさに TeX のコマンドが黒で塗りつぶされた四角で囲まれているように。定理を書いたり、レフリーレポートへの返信でレフリーのコメントを引用するときに便利だと思われる。shaded.sty は ここで入手可能。
YaTex
- M-x info をしてyatexの項目からショートカットキーを調べられる。
- M-; でコメントアウト。(emacs のコマンドかも)
- dviからpdfへの変換 : dvipdfmx -o file1.pdf file2.dvi
- \input しまくったとき input先のファイルを開くのは、C-c d
citation list
引用文献の作成は、inSPIREのツール を使うと楽。- \cite{hep-ph/1234.567, 1234.5678}
古いものは arXiv 番号がないので、論文番号を入れるのが楽だと思う。やり方は、
-
Phys.ReV.Lett, 39, 165 : \cite{PRLTA.39.165}
Phys.Lett.B, 242, 239 : \cite{PHLTA.B242.239}
Nucl.Phys.B310,693 : \cite{NUPHA.B310.693}
Phys.ReV.D74, 014007 : \cite{PHRVA.D74.014007}
JCAP 1101, 002 (2011) : \cite{JCAP.1101.002}
どうしようもなかったら、inSPIREでLaTeX(US) をクリックしてでてくる、
-
%\cite{Srednicki:1988ce}
some commands
- 横一直線 \hrule
- 文字に斜線 \cancle{D} or /\!\!\!\!D or \slashed{D} with \usepackage{slashed}
- あっちこっち微分 \tensor{\partial}
もしくは \overset{\leftrightarrow}{\partial}
- あっちこっち微分その2 \tensor{\partial}
\overset だと上つき添字の位置とか,\partial と矢印の間隔が微妙と思う。その場合は
\overset{\substack{\text{$\leftrightarrow$} \\ \vspace{-2.1ex}}}{\partial}{}^{\mu}
とする。あるいは
\newcommand{\lrpdv}[1]{\overset{\substack{\text{$\leftrightarrow$} \\ \vspace{-2.1ex}}}{\partial}{}^{#1}} として \lrpdv{\mu} - 横棒のない分数(和の記号で使いたくなった) up \atop down
- ランダウの記号 \mathcal{O} もしくは ${\cal O}$
- 図を張り付けて、図の名前を「図:名前」ではなく、
「名前」にしたいときの1例
\begin{figure}
\begin{center}
\includegraphics{../Mthesis_picture/h1000mww600.eps} \\
$M_{href}=1000$, $M_{W'}=600$
\end{center}
\end{figure}
- epsファイルのトリミングは、epsファイルをメモ帳で
開いて
%%BoundingBox: 18 23 577 819
などというところをいじ る。 - \input{}を使うとき、取り込まれるファイルの先頭に
%#!platex main.tex と書いておくと、取り込まれるファイル側でコ ンパイルができる。ここで、main.tex は、取り込む側(\input{}と書い たファイル)のファイル名 「=」の上に「?」を書きたいときには、ルビをつかう。 ルビは、例えば次のコマンドを定義して使う:%送り仮名(ルビ)\ruby{漢字}{かんじ}
\newcommand{\ruby}[2]{%
\leavevmode
\setbox0=\hbox{#1}%
\setbox1=\hbox{\tiny #2}%
\ifdim\wd0>\wd1 \dimen0=\wd0 \else \dimen0=\wd1 \fi
\hbox{%
\kanjiskip=0pt plus 2fil
\xkanjiskip=0pt plus 2fil
\vbox{%
\hbox to \dimen0{%
\tiny \hfil#2\hfil}%
\nointerlineskip
\hbox to \dimen0{\mathstrut\hfil#1\hfil}}}}- 「=」の上に「?」を書きたいときには、\overset{?}{=}
ただし amsmath が必要。
- dvioutでカラーにならないときは、dvioutの[Option]
-- [Setup Parameters] -- [Graphic] -- [GIF]で raw PBM ではなくBMP (full --
-- color) になっているか確認してみましょう。
- 画像キャプチャーを貼りたいときには、epsに変換する
か、bmp形式のをそのまま貼るかjpgでするか悩む。bmpの場合は
\includegraphics[bb=0 0 477 275]{test.bmp}のように境界を指定しなけ
ればならない。(左下の座標と右上の座標) jpgでやる場合は、dviout
がjpgを理解できるようにするための何かをインストールしておいた上で、bbを指
定しなければならない。
- 図の挿入で「includegraphics」を使うときに拡大縮小
をしたいなら、
includegraphics[scale=0.5]{test.eps}
などとする。 - 不思議な呪文 \^{,}
- 文中の改行は \\ だが、注意として、
--------------------
1行目
\\
2行目
--------------------はよいが、
--------------------
1行目
\\
2行目
--------------------
はコンパイルエラーになる。
style files
- bst-file 置き場
(例1) /usr/osxws/share/texmf/jbibtex/bst/filename.bst
(例2) /usr/local/texlive/2018/texmf-dist/bibtex/bst/
その後、sudo texhash - sty-file 置き場
(例1) /usr/osxws/share/texmf/tex/latex/hogehoge/hogehoge.sty
(例2) /usr/local/texlive/2018/texmf-dist/tex/latex/hogehoge/hogehoge.sty
その後、sudo mktexlsr
refTeX/bibTeX
- refTeX
M-x reftex-mode で次のコマンド使用可能
C-c [ で .bib に書いてある参考文献を検索できる。
- bibTeX
C-c t b でbibTeXのコンパイル。
platex -> bibtex -> platex -> platex とやる必要があるらしい。
latexmk
pdflatex のとき
latexmk -gg -pdf filename.tex
latexdiff
latexdiff old.tex new.tex > diff.tex
url
本文中に url を貼りたい時がある。そのまま http:// ... などと書くと怒られるので、
\usepackage{url}
\url{http://aaa.html}
とする。勝手にリンクも貼られる。\url のカッコ内に余計な空白は入れないこと。入れるとクリックしてもエラーが出て飛ばない。
pdf in figure
mediabb.sty を ここから ダウンロード。あとは、
\usepackage{mediabb}
を使えばよい。
ただし、arXivに投稿するときは、pdfLatexを使うので、
%\usepackage{mediabb}
と、コメントアウトせよ。
eps を変換してつくった pdf は余白ができる場合がある。その場合はターミナルで "pdfcrop aaa.pdf"
arXiv
arXivは pdfLatexを使っているらしいので、以下のことに注意。- dvipdfmをoptionに書いてはいけない。
- \usepackage[pdftex]{graphicx} と、pdftexを使う。dvipsは駄目らしい。
- \usepackage{mediabb} は書かないかコメントアウト。
- 画像ファイルはepsかpdfのどちらかに統一。混ぜるとepsが表示されなかった。
余白の設定
\usepackage[dvipdfm, top=30truemm, bottom=25truemm, left=32truemm, right=32truemm, includehead, includefoot]{geometry}
フッターを使わないなら、"includefoot"を消したほうがよい。余分な余白が作られないので。
左右の余白に関して。A4に実際に印刷してみると、
32mm は文字が少なく感じる。机に置いて見るとそうでもないが、手にもって見るとそう感じる。
31mm もまだ微妙。
30mm にすると、ちょうど良く感じる。
2mmの違いは、11ptの日本語で、2文字。
ヘッダーやフッターの設定
fanchhdr をつかう。<コマンド例>
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead[\name]{\name} %左側ヘッダの定義
\chead{ほげほげ} % 中央ヘッダの定義
\rhead[\thepage]{ほげほげ} %右側ヘッダの定義
\lfoot[偶数ページ]{奇数ページ} %左側フッターの定義
\cfoot[]{} %中央フッターの定義
\rfoot[偶数ページ]{奇数ページ}
\renewcommand{\headrulewidth}{0pt} %ヘッダの線の太さ
% 線の横幅は文章幅(\textwidth)です。
% http://keizai.xrea.jp/latex/tutorial/header.html
<実例>やりたいこと
%%----------------------------------------------------------------------
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead[\name]{\name} %左側ヘッダの定義
\rhead[\thepage]{\midashi \ \thepage /\pageref{lastpage}} %右側ヘッダの定義
\cfoot[]{} %中央フッターの定義
\renewcommand{\headrulewidth}{0pt} %ヘッダの線の太さ
% 線の横幅は文章幅(\textwidth)です。
% http://keizai.xrea.jp/latex/tutorial/header.html
%----------------------------------------------------------------------
\def\name{{阿部智広}} % define my name as \name
\def\midashi{{これまでの研究概要}} % define right head as \midashi
...
\label{lastpage}
\end{document}
日本語で書類
公募書類など。送付状などの数式を使わない場合には、Word や Pages の方が楽。
\documentclass[11pt]{jsarticle}
\usepackage[dvipdfm, top=30truemm, bottom=25truemm, left=30truemm, right=30truemm, includehead, includefoot]{geometry}
備忘録
%\RequirePackage{lineno}% revtex4 users need this command BEFORE
% \documentclass if you wanna use
% \linenumbers. Do not put \usepackage{linone}.
% ----------------------------------------------------------------------
%
\documentclass[
superscriptaddress % what's this?
%,prd % PRD format
,preprintnumbers % to use \preprint{}
,amsmath % no need to explain
,amssymb % to use \lesssim, \gtrsim, (<~, >~)
,nofootinbib % otherwise footnote appear in the last pages.
,dvipdfmx % デフォルトのドライバをdvipdfmx にする。
,eqsecnum % Number equations by section. (my preferance)
,a4paper % default is letterpaper.
,secnumarabic % Use 1,2,3, not I, II, III, in section name
,11pt % Three options: 10pt(default), 11pt, 12pt
%,preprint % I do not like this. This is 12pt.
]{revtex4}
\usepackage{graphicx} % [dvipdfxm] は上で指定しているので省略している。
\usepackage[dvipdfmx]{color} % [dvipdfxm] は上で指定しているので省略可能。
\usepackage{dcolumn} % 小数点の位置で桁をそろえる.
\usepackage{slashed} % Dirac slahs, \slashed{p}
\usepackage{bm,bbm} % to use some fonts (ベクトルを太字で書きたいとき等)
\usepackage{latexsym} % to use old math characters.
\usepackage{here} % to use figure[H]
%\usepackage{ascmac} % to use `\itembox' (yatex added)
\usepackage{mathrsfs} % 花文字
\usepackage{multirow} % やや複雑な表を作るとき
%\usepackage{lineno} % 行を表示する. Use RequirePackage{lineno}
\usepackage{mediabb} % to use xxx.pdf for including plots without
% bb files. we can generate bb files by ebb command.
%\usepackage{jheppub} % ここより下だと、hyperrefと相性が悪いと怒られる。
\usepackage{hyperref} % to make links in equations or refferences.
\usepackage{subfigure} % 図の中で、(a) (b) (c) とつけたいとき。
\usepackage{titlesec} % To use \newcommand*{\justifyheading}{\raggedleft}
\usepackage{ulem} % To use \sout{hoge} (上から線を引く)
%----------------------------------------------------------------------
%----------------------------------------------------------------------
% too old to use
%----------------------------------------------------------------------
%\usepackage[dvips]{color} % too old to use...
%\usepackage{cancel} % to use \cancle{p} etc.
%----------------------------------------------------------------------
%----------------------------------------------------------------------
\pagestyle{plain}
\newcommand{\tr}{\mbox{tr}}
\newcommand{\VEV}[1]{\langle #1 \rangle}
\newcommand{\ii}{\mathbbm{i}}
\newcommand{\1}{\mbox{1}\hspace{-0.25em}\mbox{l}} % identity matrix
\newcommand{\fb}{fb$^{-1}$}
\newcommand{\pb}{pb$^{-1}$}
\newcommand{\pt}{$p_{\mathrm{T}}$}
\newcommand{\pz}{$p_{Z}$}
\newcommand{\pznu}{$p_{Z}^{\nu}$}
\newcommand{\MET}{$E_{\mathrm{T}}^{\mathrm{miss}}$}
\newcommand{\mycomment}[1]{\textcolor{blue}{\textbf{#1}}}
%-----------------------------------------------------------------------------
% \slashchar puts a slash through a character to represent contraction
% with Dirac matrices. Use \not instead for negation of relations, and use
% \hbar for hbar.
%-----------------------------------------------------------------------------
\def\slashchar#1{\setbox0=\hbox{$#1$} % set a box for #1
\dimen0=\wd0 % and get its size
\setbox1=\hbox{/} \dimen1=\wd1 % get size of /
\ifdim\dimen0>\dimen1 % #1 is bigger
\rlap{\hbox to \dimen0{\hfil/\hfil}} % so center / in box
#1 % and print #1
\else % / is bigger
\rlap{\hbox to \dimen1{\hfil$#1$\hfil}} % so center #1
/ % and print /
\fi}
%-----------------------------------------------------------------------------
% When we use \linenumber, we need this makeatletter. If we do not use
% this makeatlettr, line numbers are not printed near equations. This is
% because lineno.sty are not familiar with \begin{aling}~\end{aling}.
%-----------------------------------------------------------------------------
\makeatletter
% Make a copy of macros responsible for entering display math mode
\let\start@align@nopar\start@align
\let\start@gather@nopar\start@gather
\let\start@multline@nopar\start@multline
% Add the "empty line" command to the macros
\long\def\start@align{\par\start@align@nopar}
\long\def\start@gather{\par\start@gather@nopar}
\long\def\start@multline{\par\start@multline@nopar}
\makeatother
%-----------------------------------------------------------------------------
% Change the format of sections in revtex
%-----------------------------------------------------------------------------
% Section names are centering in revtex. I do not like it. I want to
% make them flushleft. I found the following command achieves my wish.
%
% In addition, \section{hogehoge} becomes HOGEHOGE in pdf file. I do not
% like this neither. The following section also change this format.
%
% Comment out the followings when you submit to journal.
%-----------------------------------------------------------------------------
%
%\newcommand*{\justifyheading}{\raggedleft}
\newcommand*{\justifyheading}{\raggedright}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\justifyheading}{\chaptertitlename\ \thechapter}
{20pt}{\Huge}
\titleformat{\section}
{\normalfont\Large\bfseries\justifyheading}{\thesection}{1em}{}
\titleformat{\subsection}
{\normalfont\large\bfseries\justifyheading}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\normalfont\bfseries\justifyheading}{\thesubsubsection}{1em}{}
\usepackage[english]{babel}
%-----------------------------------------------------------------------------
% End of makeat letter
%-----------------------------------------------------------------------------
%\usepackage{amsmath} % required for `\align' (yatex added)
\begin{document}
%\setpagewiselinenumbers
%\modulolinenumbers[5]
%\linenumbers % to show the line numbers (need \RequirePackage{lineno})
%----------------------------------------------------------------------
% Title
%----------------------------------------------------------------------
\preprint{}
\preprint{}
\title{Unitarity Sum Rules}
\author{Tomohiro Abe}
\affiliation{Place}
\date{\today}
%\date{June 13, 2012 \\ \ \ revised:\today}
\begin{abstract}
\end{abstract}
\maketitle
%----------------------------------------------------------------------
% Body
%----------------------------------------------------------------------
\end{document}